//
//  LXImageOnTopButton.m
//  cat
//
//  Created by imera on 16/3/15.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "LXImageOnTopButton.h"

@implementation LXImageOnTopButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self){
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGFloat frameX = 0;
    CGFloat frameY = contentRect.size.height * LXImageOnTopButtonBili;
    CGFloat frameW = contentRect.size.width;
    CGFloat frameH = contentRect.size.height * (1 - LXImageOnTopButtonBili);
    return CGRectMake(frameX, frameY, frameW, frameH);
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGFloat frameX = 0;
    CGFloat frameY = 0;
    CGFloat frameW = contentRect.size.width;
    CGFloat frameH = contentRect.size.height * LXImageOnTopButtonBili;
    return CGRectMake(frameX, frameY, frameW, frameH);
}
@end
